﻿Public Class SOFTWAREEDIT
    Public Sub New(prgid As Integer, prgCode As String, prgName As String, prgStatus As Integer)

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        swID.Text = prgid
        softwareCodeTxt.Text = prgCode
        softwareNameTxt.Text = prgName

        If prgStatus = 1 Then
            masprgStatusChk.Checked = True
        Else
            masprgStatusChk.Checked = False
        End If
    End Sub

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Private Sub editMasprg_Click(sender As Object, e As EventArgs) Handles editMasprg.Click
        If softwareCodeTxt.Text.Length.ToString > 0 And softwareNameTxt.Text.ToString.Length > 0 Then
            Dim editStat As Integer
            editStat = MsgBox("ท่านต้องการแก้ไขข้อมูลโปรแกรมใช่หรือไม่", MsgBoxStyle.OkCancel)

            If editStat = 1 Then
                Dim objEditSW As New SOFTWAREGROUPCLASS
                objEditSW.PRGID_ = swID.Text
                objEditSW.PRGCODE_ = softwareCodeTxt.Text
                objEditSW.PRGNAME_ = softwareNameTxt.Text
                objEditSW.masprgSTATUS_ = masprgStatusChk.Checked

                If objEditSW.editMasprg = True Then
                    MsgBox("ท่านได้ทำการแก้ไขข้อมูลโปรแกรมเรียบร้อยแล้ว")
                    DialogResult = Windows.Forms.DialogResult.OK
                    Me.Close()
                End If
            Else
                MsgBox("โปรดกรุณาระบุชื่อซอฟต์แวร์")
            End If
        End If
    End Sub

    Private Sub SOFTWAREEDIT_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class